package com.ebt.m.policy;

import android.os.Bundle;
import android.support.v4.app.FragmentTransaction;
import android.widget.FrameLayout;

import com.ebt.m.R;
import com.ebt.m.activity.BaseToolBarActivity;
import com.ebt.m.policy.bean.EventFinishAct;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * @author Damon.Han
 */
public class ActSearchProposalMore extends BaseToolBarActivity {
    @BindView(R.id.proposal_root)
    FrameLayout frameLayout;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.act_online_policy_search_more_proposal);
        ButterKnife.bind(this);
        EventBus.getDefault().register(this);
    }

    @Override
    protected void init() {
        super.init();
        String wd = (String) getIntent().getSerializableExtra("data");
        if (wd == null) {
            return;
        }
        setTitle("更多计划书");
        FrgChooseByProposals frgChooseByProposals = FrgChooseByProposals.newInstance(wd);
        FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
        fragmentTransaction.replace(R.id.proposal_root, frgChooseByProposals);
        fragmentTransaction.commit();

    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        EventBus.getDefault().unregister(this);
    }

    @Subscribe
    public void onEvent(EventFinishAct event) {
        finish();
    }
}
